﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core.DS
{
    public static partial class statistics
    {
        public static dynamic submitPoint(string sid, int point)
        {
            var sql = new Sql.SqlDataContext();
            var ds = sql.DSExperimentSolve.FirstOrDefault(row => row.sid == sid);
            if (ds == null)
            {
                return new
                {
                    success = false,
                    msg = "找不到该学生，或者是该学生没上传实验报告"
                };
            }
            sql.DSExperimentSolve.DeleteOnSubmit(ds);
            ds.point = point;
            sql.DSExperimentSolve.InsertOnSubmit(ds);
            sql.SubmitChanges();
            return new
            {
                success = true
            };
        }
    }
}
